Adding some more judges, here and there.
[and.git] / lib / Mi manual de algoritmos / version_world_finals_2009 / src / geometria / polygon_area.cpp
blob4a230d793be92e0767c427587a4ee5f2df855fae
1 //P es un polĂ­gono ordenado anticlockwise.
2 //Si es clockwise, retorna el area negativa.
3 //Si no esta ordenado retorna pura mierda.
4 //P[0] != P[n-1]
5 double PolygonArea(const vector<point> &p){
6 double r = 0.0;
7 for (int i=0; i<p.size(); ++i){
8 int j = (i+1) % p.size();
9 r += p[i].x*p[j].y - p[j].x*p[i].y;
11 return r/2.0;